/*

 */

$(function () {

    $(".btn-sign-up").on("click", function () {
        var $email = $("#user-email");
        var $name = $("#user-name");
        var $password = $("#user-password");
        var $password_again = $("#user-password-again");
        var email = $email.val();
        var name = $name.val();
        var password = $password.val();
        var password_again = $password_again.val();
        var read = 0;
        if ($("#remember-me").is(":checked")) read = 1; else {
            xcsoft.error("请先同意注册协议", 1000);
            return 0;
        }
        if (!(/^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(email))) {
            $email.focus();
            $email.select();
            xcsoft.error("不是正确的邮箱", 1000);
            return 0;
        }
        if (password !== password_again) {
            $password_again.focus();
            $password_again.select();
            xcsoft.error("第二次密码验证不正确", 1000);
            return 0;
        }
        if (email === '' || name === '' || password === '' || password_again === '') {
            xcsoft.info("还有什么没有填写完", 1000);
            var i = false;
            $("input").each(function () {
                if (i === false) {
                    if ($(this).val() === '') {
                        $(this).focus();
                        i = true;
                    }
                }
            })
            return 0;
        }
        xcsoft.loading("注册中...");
        $(this).addClass("am-disabled");
        $("input").attr("disabled", true);
        $.ajax({
            url: "admin-posts.php",
            type: "POST",
            async: true,
            timeOut: 50000,
            dataType: "json",
            data: {
                type: "sign-up",
                email: email,
                name: name,
                password: password,
                password_again: password_again,
                read: read
            },
            success: function (data, textStatus, jqXHR) {
                console.log(data);
                if (data.status === 0) {
                    xcsoft.success("注册成功，1秒后跳转到登录界面", 1000);
                    setTimeout('window.location.href = "./login.php";', 1000);
                } else {
                    $(this).removeClass("am-disabled");
                    $("input").attr("disabled", false);
                    xcsoft.error("注册失败", 1000);
                    console.log(data.error);
                }
            },
            error: function (xhr, textStatus) {
                $(this).removeClass("am-disabled");
                $("input").attr("disabled", false);
                xcsoft.error("注册失败", 1000);
                console.log(xhr + textStatus);
            }
        })
    })

    $(".btn-login").on("click", function () {
        var $name = $("#user-name");
        var $password = $("#user-password");
        var name = $name.val();
        var password = $password.val();
        if (name === '') {
            xcsoft.error("请填写用户名", 1000);
            $name.focus();
            return 0;
        }
        if (password === '') {
            xcsoft.error("请填写密码", 1000);
            $password.focus();
            return 0;
        }
        var remember = 0;
        if ($("#remember-me").is(":checked")) remember = 1;
        $("input").attr("disabled", true);
        $(this).addClass("am-disabled");
        $.ajax({
            url: "admin-posts.php",
            type: "POST",
            async: true,
            timeOut: 50000,
            dataType: "json",
            data: {
                type: "login",
                name: name,
                password: password,
                remember: remember
            },
            success: function (data, textStatus, jqXHR) {
                $("input").attr("disabled", false);
                console.log(data);
                if (data.status === 0) {
                    xcsoft.success("登录成功，1秒后跳转到登录界面", 1000);
                    setTimeout('window.location.href = "./login.php";', 1000);
                } else {
                    xcsoft.error("登录失败", 1000);
                    console.log(data.error);
                }
            },
            error: function (xhr, textStatus) {
                $("input").attr("disabled", false);
                xcsoft.error("登录失败", 1000);
                console.log(xhr + textStatus);
            }
        })
    })

    $(".password-safe").on("keyup", function () {
        var $password = $("#user-password");
        var $am_fr = $(".am-fr");
        var $am_progress_bar = $(".am-progress-bar");
        var password = $password.val();
        var i = 0;
        if (/[0-9]/.test(password)) i += 10;
        if (/[a-z]/.test(password)) i += 10;
        if (/[A-Z]/.test(password)) i += 10;
        if (/[^\w]/.test(password)) i += 20;
        if (password.length > 10) i += 20;
        if (password.length > 20) i += 30;
        if (i === 0) {
            $am_fr.html("无");
            $am_progress_bar.addClass("am-progress-bar-danger");
            $am_progress_bar.removeClass("am-progress-bar-warning");
        } else if (i < 50) {
            $am_fr.html("低");
            $am_progress_bar.addClass("am-progress-bar-danger");
            $am_progress_bar.removeClass("am-progress-bar-warning");
        } else if (i < 80) {
            $am_fr.html("中");
            $am_progress_bar.removeClass("am-progress-bar-danger");
            $am_progress_bar.addClass("am-progress-bar-warning");
        } else {
            $am_fr.html("高");
            $am_progress_bar.removeClass("am-progress-bar-danger");
            $am_progress_bar.removeClass("am-progress-bar-warning");
        }
        $am_progress_bar.attr("style", "width: " + i + "%");
    })


    $("#sign-out").on("click", function () {
        if (!confirm("确认登出？")) return;
        $.ajax({
            url: "admin-posts.php",
            type: "POST",
            async: true,
            timeOut: 50000,
            dataType: "json",
            data: {
                type: "sign-out"
            },
            success: function (data, textStatus, jqXHR) {
                console.log(data);
                if (data.status === 0) {
                    xcsoft.success("登出成功，1秒后跳转到登录界面", 1000);
                    setTimeout('window.location.href = "./login.php";', 1000);
                } else {
                    xcsoft.error("登出失败", 1000);
                    console.log(data.error);
                }
            },
            error: function (xhr, textStatus) {
                xcsoft.error("登出失败", 1000);
                console.log(xhr + textStatus);
            }
        })
    })

    $("#submit-website-set").on("click", function () {
        //站点开关
        var i_switch = 1;
        if (!$("#user-switch").is(":checked")) i_switch = 0;
        var title = $("#user-title").val();
        var slogan = $("#user-slogan").val();
        var logo = $("#user-logo").attr("src");
        var code = $("#user-code").attr("src");
        var key = $("#user-key").val();
        var company = $("#user-company").val();
        var phone = $("#user-phone").val();
        var intro = $("#user-intro").val().replace(/\r/g, "<br/>").replace(/\n/g, "<bn/>");
        var icp = $("#user-icp").val();
        var copyright = $("#user-copyright").val();
        var http = $("#user-http").val();
        var submit_array = {
            "switch": i_switch,
            "title": title,
            "slogan": slogan,
            "logo": logo,
            "code": code,
            "key": key,
            "company": company,
            "phone": phone,
            "intro": intro,
            "icp": icp,
            "copyright": copyright,
            "http": http
        }
        var submit_json = JSON.stringify(submit_array);
        console.log(submit_json);
        $("input").attr("disabled", true);
        xcsoft.loading("修改中...");
        $(this).addClass("am-disabled");
        $.ajax({
            url: "admin-posts.php",
            type: "POST",
            async: true,
            timeOut: 50000,
            dataType: "json",
            data: {
                type: "website-set",
                json: submit_json
            },
            success: function (data, textStatus, jqXHR) {
                $("input").attr("disabled", false);
                $("#submit-website-set").removeClass("am-disabled");
                console.log(data);
                if (data.status === 0) {
                    xcsoft.success("修改成功", 1000);
                } else {
                    xcsoft.error("修改失败", 1000);
                    console.log(data.error);
                }
            },
            error: function (xhr, textStatus) {
                $("input").attr("disabled", false);
                $("#submit-website-set").removeClass("am-disabled");
                xcsoft.error("修改失败", 1000);
                console.log(xhr + textStatus);
            }
        })
    })

    $("#submit-about-set").on("click", function () {
        var image1 = $("#user-image1").attr("src");
        var image2 = $("#user-image2").attr("src");
        var image3 = $("#user-image3").attr("src");
        var intro = $("#user-intro").val().replace(/\r/g, "<br/>").replace(/\n/g, "<bn/>");
        var submit_array = {
            "image1": image1,
            "image2": image2,
            "image3": image3,
            "intro": intro
        }
        var submit_json = JSON.stringify(submit_array);
        console.log(submit_json);
        xcsoft.loading("修改中...");
        $("input").attr("disabled", true);
        $(this).addClass("am-disabled");
        $.ajax({
            url: "admin-posts.php",
            type: "POST",
            async: true,
            timeOut: 50000,
            dataType: "json",
            data: {
                type: "about-set",
                json: submit_json
            },
            success: function (data, textStatus, jqXHR) {
                $("input").attr("disabled", false);
                $("#submit-about-set").removeClass("am-disabled");
                console.log(data);
                if (data.status === 0) {
                    xcsoft.success("修改成功", 1000);
                } else {
                    xcsoft.error("修改失败", 1000);
                    console.log(data.error);
                }
            },
            error: function (xhr, textStatus) {
                $("input").attr("disabled", false);
                $("#submit-about-set").removeClass("am-disabled");
                xcsoft.error("修改失败", 1000);
                console.log(xhr + textStatus);
            }
        })
    })

    $("#add-about").on("click", function () {
        var name = $("#user-name").val();
        var head = $("#user-about-head").attr("src");
        var job = $("#user-job").val();
        var submit_array = {
            "name": name,
            "head": head,
            "job": job
        }
        var submit_json = JSON.stringify(submit_array);
        console.log(submit_json);
        $("input").attr("disabled", true);
        $(this).addClass("am-disabled");
        xcsoft.loading("添加中...");
        $.ajax({
            url: "admin-posts.php",
            type: "POST",
            async: true,
            timeOut: 50000,
            dataType: "json",
            data: {
                type: "add-about",
                json: submit_json
            },
            success: function (data, textStatus, jqXHR) {
                console.log(data);
                if (data.status === 0) {
                    xcsoft.success("添加成功", 1000);
                    setTimeout("window.location.href='./set-about.php'", 1000);
                } else {
                    $("input").attr("disabled", false);
                    $("#add-about").removeClass("am-disabled");
                    xcsoft.error("添加失败", 1000);
                    console.log(data.error);
                }
            },
            error: function (xhr, textStatus) {
                $("input").attr("disabled", false);
                $("#add-about").removeClass("am-disabled");
                xcsoft.error("添加失败", 1000);
                console.log(xhr + textStatus);
            }
        })
    })

    $("#add-swipe").on("click", function () {
        var image = $("#user-swipe-image").attr("src");
        var title = $("#user-title").val();
        var content = $("#user-content").val();
        var url = $("#user-url").val();
        var submit_array = {
            "image": image,
            "title": title,
            "content": content,
            "url": url
        }
        var submit_json = JSON.stringify(submit_array);
        console.log(submit_json);
        $("input").attr("disabled", true);
        $(this).addClass("am-disabled");
        xcsoft.loading("添加中...");
        $.ajax({
            url: "admin-posts.php",
            type: "POST",
            async: true,
            timeOut: 50000,
            dataType: "json",
            data: {
                type: "add-swipe",
                json: submit_json
            },
            success: function (data, textStatus, jqXHR) {
                console.log(data);
                if (data.status === 0) {
                    xcsoft.success("添加成功", 1000);
                    setTimeout("window.location.href='./set-index.php'", 1000);
                } else {
                    $("input").attr("disabled", false);
                    $("#add-swipe").removeClass("am-disabled");
                    xcsoft.error("添加失败", 1000);
                    console.log(data.error);
                }
            },
            error: function (xhr, textStatus) {
                $("input").attr("disabled", false);
                $("#add-swipe").removeClass("am-disabled");
                xcsoft.error("添加失败", 1000);
                console.log(xhr + textStatus);
            }
        })
    })

    $("#add-index-show").on("click", function () {
        $("input").attr("disabled", true);
        $(this).addClass("am-disabled");
        xcsoft.loading("添加中...");
        var image = $("#user-index-show-image").attr("src");
        var title = $("#user-title").val();
        var alt = $("#user-alt").val();
        var url = $("#user-url").val();
        var submit_array = {
            "image": image,
            "title": title,
            "alt": alt,
            "url": url
        }
        var submit_json = JSON.stringify(submit_array);
        console.log(submit_json);
        $.ajax({
            url: "admin-posts.php",
            type: "POST",
            async: true,
            timeOut: 50000,
            dataType: "json",
            data: {
                type: "add-index-show",
                json: submit_json
            },
            success: function (data, textStatus, jqXHR) {
                console.log(data);
                if (data.status === 0) {
                    xcsoft.success("添加成功", 1000);
                    setTimeout("window.location.href='./set-index.php'", 1000);
                } else {
                    $("input").attr("disabled", false);
                    $("#add-index-show").removeClass("am-disabled");
                    xcsoft.error("添加失败", 1000);
                    console.log(data.error);
                }
            },
            error: function (xhr, textStatus) {
                $("input").attr("disabled", false);
                $("#add-index-show").removeClass("am-disabled");
                xcsoft.error("添加失败", 1000);
                console.log(xhr + textStatus);
            }
        })
    })

    $("#add-index-news").on("click", function () {
        $("input").attr("disabled", true);
        $(this).addClass("am-disabled");
        xcsoft.loading("添加中...");
        var title = $("#user-title").val();
        var image = $("#user-index-news-image").attr("src");
        var content = $("#user-content").val();
        var url = $("#user-url").val();
        var submit_array = {
            "title": title,
            "image": image,
            "content": content,
            "url": url
        }
        var submit_json = JSON.stringify(submit_array);
        console.log(submit_json);
        $.ajax({
            url: "admin-posts.php",
            type: "POST",
            async: true,
            timeOut: 50000,
            dataType: "json",
            data: {
                type: "add-index-news",
                json: submit_json
            },
            success: function (data, textStatus, jqXHR) {
                console.log(data);
                if (data.status === 0) {
                    xcsoft.success("添加成功", 1000);
                    setTimeout("window.location.href='./set-index.php'", 1000);
                } else {
                    $("input").attr("disabled", false);
                    $("#add-index-news").removeClass("am-disabled");
                    xcsoft.error("添加失败", 1000);
                    console.log(data.error);
                }
            },
            error: function (xhr, textStatus) {
                $("input").attr("disabled", false);
                $("#add-index-news").removeClass("am-disabled");
                xcsoft.error("添加失败", 1000);
                console.log(xhr + textStatus);
            }
        })
    })

    $("#add-news").on("click", function () {
        $("input").attr("disabled", true);
        $(this).addClass("am-disabled");
        xcsoft.loading("添加中...");
        var title = $("#user-title").val();
        var show_image = $("#user-show-news-image").attr("src");
        var show_content = $("#user-show-content").val();
        var content = tinyMCE.activeEditor.getContent()
            .replace(/(<!DOCTYPE\shtml>\n<html>\n<head>\n<\/head>\n<body>)/g, "<div class=\"new-details-container-t\">")
            .replace(/(<\/body>\n<\/html>)/g, "</div>")
            .replace(/(\[img\])/g, "<img class=\"new-details-container-t-img\" src=\"")
            .replace(/(\[\/img\])/g, "\">")
            .replace(/(\n)/g, "</div><div class=\"new-details-container-t\">");//tinyMCE.getInstanceById('id_content').getBody().innerHTML
        var submit_array = {
            "title": title,
            "show_image": show_image,
            "show_content": show_content,
            "content": content
        }
        var submit_json = JSON.stringify(submit_array);
        console.log(submit_json);
        $.ajax({
            url: "admin-posts.php",
            type: "POST",
            async: true,
            timeOut: 50000,
            dataType: "json",
            data: {
                type: "add-news",
                json: submit_json
            },
            success: function (data, textStatus, jqXHR) {
                console.log(data);
                if (data.status === 0) {
                    xcsoft.success("添加成功", 1000);
                    tinymce.remove("textareatiny");
                    setTimeout("window.location.href='./set-news.php'", 1000);
                } else {
                    $("input").attr("disabled", false);
                    $("#add-index-news").removeClass("am-disabled");
                    xcsoft.error("添加失败", 1000);
                    console.log(data.error);
                }
            },
            error: function (xhr, textStatus) {
                $("input").attr("disabled", false);
                $("#add-index-news").removeClass("am-disabled");
                xcsoft.error("添加失败", 1000);
                console.log(xhr + textStatus);
            }
        })
    })

    $("#index-auto-about").on("click", function () {
        xcsoft.loading("获取中...");
        $.ajax({
            url: "admin-posts.php",
            type: "POST",
            async: true,
            timeOut: 50000,
            dataType: "json",
            data: {type: "index-auto-about"},
            success: function (data, textStatus, jqXHR) {
                console.log(data);
                if (data.status === 0) {
                    var assoc = data.array;
                    $("#about-title").val("为什么选择我们");
                    $("#about-up").attr("src", assoc.image[0]);
                    $("#about-down").attr("src", assoc.image[1]);
                    $("#about-content").val(assoc.content);
                    xcsoft.success("添加成功", 1000);
                } else {
                    xcsoft.error("添加失败", 1000);
                    console.log(data.error);
                }
            },
            error: function (xhr, textStatus) {
                xcsoft.error("添加失败", 1000);
                console.log(xhr + textStatus);
            }
        })
    })

    $("#submit-index-about-set").on("click", function () {
        $("input").attr("disabled", true);
        xcsoft.loading("提交中...");
        $(this).addClass("am-disabled");
        var image_up = $("#about-up").attr("src");
        var image_down = $("#about-down").attr("src");
        var content = $("#about-content").val();
        var title = $("#about-title").val();
        var submit_array = {
            "title": title,
            "image_up": image_up,
            "image_down": image_down,
            "content": content
        }
        var submit_json = JSON.stringify(submit_array);
        console.log(submit_json);
        $.ajax({
            url: "admin-posts.php",
            type: "POST",
            async: true,
            timeOut: 50000,
            dataType: "json",
            data: {
                type: "index-about-set",
                json: submit_json
            },
            success: function (data, textStatus, jqXHR) {
                $(this).removeClass("am-disabled");
                $("input").attr("disabled", false);
                console.log(data);
                if (data.status === 0) {
                    xcsoft.success("修改成功", 1000);
                } else {
                    xcsoft.error("修改失败", 1000);
                    console.log(data.error);
                }
            },
            error: function (xhr, textStatus) {
                $(this).removeClass("am-disabled");
                $("input").attr("disabled", false);
                xcsoft.error("修改失败", 1000);
                console.log(xhr + textStatus);
            }
        })
    })

    $("#add-role").on("click", function () {
        $(this).addClass("am-disabled");
        $("input").attr("disabled", true);
        var name = $("#user-name").val();
        var des = $("#user-des").val();
        var access = 0;
        if ($("#user-access").is(":checked")) {
            access = 1;
        }
        var sort = $("#user-sort").val();
        var mod = $("#user-mod option:selected").val();
        var submit_array = {
            "name": name,
            "des": des,
            "access": access,
            "sort": sort,
            "mod": mod
        };
        var submit_json = JSON.stringify(submit_array);
        console.log(submit_json);
        $.ajax({
            url: "admin-posts.php",
            type: "POST",
            async: true,
            timeOut: 50000,
            dataType: "json",
            data: {
                type: "add-role",
                json: submit_json
            },
            success: function (data, textStatus, jqXHR) {
                console.log(data);
                if (data.status === 0) {
                    xcsoft.success("添加成功", 1000);
                    setTimeout("window.location.href='./set-users.php'", 1000);
                } else {
                    $("input").attr("disabled", false);
                    $("#add-role").removeClass("am-disabled");
                    xcsoft.error("添加失败", 1000);
                    console.log(data.error);
                }
            },
            error: function (xhr, textStatus) {
                $("input").attr("disabled", false);
                $("#add-role").removeClass("am-disabled");
                xcsoft.error("添加失败", 1000);
                console.log(xhr + textStatus);
            }
        })
    })

    $("#add-user").on("click", function () {
        $(this).addClass("am-disabled");
        $("input").attr("disabled", true);
        var name = $("#user-name").val();
        var des = $("#user-des").val();
        var access = 0;
        if ($("#user-access").is(":checked")) {
            access = 1;
        }
        var sort = $("#user-sort").val();
        var mod = $("#user-mod option:selected").val();
        var submit_array = {
            "name": name,
            "des": des,
            "access": access,
            "sort": sort,
            "mod": mod
        };
        var submit_json = JSON.stringify(submit_array);
        console.log(submit_json);
        $.ajax({
            url: "admin-posts.php",
            type: "POST",
            async: true,
            timeOut: 50000,
            dataType: "json",
            data: {
                type: "add-role",
                json: submit_json
            },
            success: function (data, textStatus, jqXHR) {
                console.log(data);
                if (data.status === 0) {
                    xcsoft.success("添加成功", 1000);
                    setTimeout("window.location.href='./set-users.php'", 1000);
                } else {
                    $("input").attr("disabled", false);
                    $("#add-role").removeClass("am-disabled");
                    xcsoft.error("添加失败", 1000);
                    console.log(data.error);
                }
            },
            error: function (xhr, textStatus) {
                $("input").attr("disabled", false);
                $("#add-role").removeClass("am-disabled");
                xcsoft.error("添加失败", 1000);
                console.log(xhr + textStatus);
            }
        })
    })


})


$("#upload-logo").on("change", function () {
    submit_image("#submit-logo", "button-logo", "#user-logo")
})
$("#upload-code").on("change", function () {
    submit_image("#submit-code", "button-code", "#user-code")
})


$("#upload-image1").on("change", function () {
    submit_image("#submit-image1", "button-image1", "#user-image1")
})
$("#upload-image2").on("change", function () {
    submit_image("#submit-image2", "button-image2", "#user-image2")
})
$("#upload-image3").on("change", function () {
    submit_image("#submit-image3", "button-image3", "#user-image3")
})

$("#upload-image-up").on("change", function () {
    submit_image("#submit-about-up", "button-about-up", "#about-up")
})

$("#upload-image-down").on("change", function () {
    submit_image("#submit-about-down", "button-about-down", "#about-down")
})

$("#upload-about-head").on("change", function () {
    submit_image("#submit-about-head", "button-about-head", "#user-about-head")
})


$("#upload-swipe-image").on("change", function () {
    submit_image("#submit-swipe-image", "button-swipe-image", "#user-swipe-image")
})


$("#upload-index-show-image").on("change", function () {
    submit_image("#submit-index-show-image", "button-index-show-image", "#user-index-show-image")
})


$("#upload-index-news-image").on("change", function () {
    submit_image("#submit-index-news-image", "button-index-news-image", "#user-index-news-image")
})


$("#upload-show-news-image").on("change", function () {
    submit_image("#submit-show-news-image", "button-show-news-image", "#user-show-news-image")
})

$("#upload-add-news-image").on("change", function () {
    add_image("#submit-add-news-image", "button-add-news-image")
})

function add_image(submit, show) {
    var show_text = $(show).html();
    $(submit).ajaxSubmit({
        dataType: "json", //数据格式为json
        beforeSend: function () { //开始上传
            $(show).html("<i class=\"am-icon-spinner am-icon-spin\"></i> 上传中...");
        },
        uploadProgress: function (event, position, total, percentComplete) {
            var percentVal = percentComplete + "%"; //获得进度
            xcsoft.loading("正在上传..." + percentVal);
        },
        success: function (data) {
            console.log(data);
            if (data.status === 0) {
                xcsoft.success('上传成功', 1000);
                $(show).html(show_text);
                var url = data.url;
                tinyMCE.execCommand("mceInsertContent", false, "[img]" + data.url + "[/img]");
            } else {
                xcsoft.error('上传失败', 1000);
                console.log(data.error);
            }
        },
        error: function (xhr, tS, rT) { //上传失败
            xcsoft.error('上传失败', 1000);
            $(show).html(show_text);
            return 0;
        }
    })
}

function submit_image(submit, show, change) {
    var show_text = $(show).html();
    $(submit).ajaxSubmit({
        dataType: "json", //数据格式为json
        beforeSend: function () { //开始上传
            $(show).html("<i class=\"am-icon-spinner am-icon-spin\"></i> 上传中...");
        },
        uploadProgress: function (event, position, total, percentComplete) {
            var percentVal = percentComplete + "%"; //获得进度
            xcsoft.loading("正在上传..." + percentVal);
        },
        success: function (data) {
            console.log(data);
            if (data.status === 0) {
                xcsoft.success('上传成功', 1000);
                $(show).html(show_text);
                $(change).attr("src", data.url);
            } else {
                xcsoft.error('上传失败', 1000);
                console.log(data.error);
            }
        },
        error: function (xhr, tS, rT) { //上传失败
            xcsoft.error('上传失败', 1000);
            $(show).html(show_text);
            return 0;
        }
    })
}

function ajax_build_html(html) {
    $.ajax({
        url: "admin-posts.php",
        type: "POST",
        async: true,
        timeOut: 50000,
        dataType: "json",
        data: {
            type: "ajax_build_html",
            html: html
        },
        success: function (data, textStatus, jqXHR) {
            console.log(data);
            if (data.status === 0) {
                xcsoft.success("生成完毕", 1000);
                $(".html-name").each(function () {
                    if ($(this).html() === html)
                        $(this).parent().children(".build-date").html("<span style='color: green'>" + data.time + "</span>");
                })
            } else {
                xcsoft.error("生成失败", 1000);
                console.log(data.error);
            }
        },
        error: function (xhr, textStatus) {
            xcsoft.error("生成失败", 1000);
            console.log(xhr + textStatus);
        }
    })
}
